<template>
  <view class="home">
    <view class="reserve-item" @click="$u.route(`/pages/index/housingResources/salesHouse?id=${item.id}&type=2`)"
      v-for="(item,index) in list" :key="item.id">
      <view class="u-m-b-20 u-p-b-22 u-flex-y-center u-border-bottom">
        <u-text :text="item.createtime_text" color="#666" size="13"></u-text>
        <u-text text="已发布" align="right" color="#F87610" size="14"></u-text>
      </view>
      <u-text text="房屋编号：6516416466848" color="#000" bold></u-text>
      <u-text margin="12rpx 0" size="14" text="`小区名称：${item.xiaoqu}`" color="#333"></u-text>
      <u-text :text="`房型：${item.house_type_text}`" color="#666" size="13"></u-text>
      <u-text margin="12rpx 0" :text="`建筑面积：${item.space}平米`" color="#666" size="13"></u-text>
      <view class="u-border-top u-p-t-20">
        <u-row>
          <u-col span="3">
            <u-text align="center" :text="item.statistics.yesterday_views" color="#e22020" bold></u-text>
            <u-text align="center" text="昨日浏览量" color="#000" size="12"></u-text>
          </u-col>
          <u-col span="3">
            <u-text :text="item.statistics.total_views" align="center" color="#e22020" bold></u-text>
            <u-text text="总浏览量" align="center" color="#000" size="12"></u-text>
          </u-col>
          <u-col span="3">
            <u-text align="center" :text="item.statistics.collect_num" color="#e22020" bold></u-text>
            <u-text align="center" text="关注人数" color="#000" size="12"></u-text>
          </u-col>
          <u-col span="3">
            <u-text align="center" :text="item.statistics.order_num" color="#e22020" bold></u-text>
            <u-text align="center" text="带看次数" color="#000" size="12"></u-text>
          </u-col>
        </u-row>
      </view>
    </view>
  </view>
</template>

<script setup>
  import { onMounted, ref } from 'vue';
  import { onShow, onReachBottom } from '@dcloudio/uni-app'
  import { sell_lst } from '../../../config/api';
  const params = ref({
    page: 1,
    limit: 15
  })
  const list = ref([])
  onShow(() => {
    _sell_lst()
  })
  onReachBottom(() => {
    params.value.page = 1
    _sell_lst()
  })
  const _sell_lst = () => {
    sell_lst(params.value).then(res => {
      console.log(res)
      if (params.value.page == 1) list.value = res.data
      else list.value = list.value.concat(res.data)
    })
  }
</script>

<style lang="scss" scoped>
  .reserve-item {
    background: #fff;
    border-radius: 24rpx;
    padding: 20rpx;
    margin: 20rpx;
  }
</style>